package cn.edu.stu.syllabus.widgets;

import android.support.v4.widget.NestedScrollView;

import com.orhanobut.logger.Logger;

/**
 * Created by daidaijie on 2017/4/22.
 */

public class NestedScrollViewScrollAdapter implements NestedScrollView.OnScrollChangeListener {

    @Override
    public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {

        if (scrollY == 0) {
            onScrollToTop();
            return;
        }

        if (scrollY >= (v.getChildAt(0).getMeasuredHeight() - v.getMeasuredHeight())) {
            onScrollToBottom();
            return;
        }

        if (scrollY > oldScrollY) {
            onScrollToDown(scrollY - oldScrollY);
            return;
        }

        if (scrollY < oldScrollY) {
            onScrollToUp(oldScrollY - scrollY);
            return;
        }

    }

    public void onScrollToBottom() {

    }

    public void onScrollToTop() {

    }

    public void onScrollToUp(int offset) {

    }

    public void onScrollToDown(int offset) {

    }
}
